home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-21 | 419 b | 21 lines | [TEXT/ttxt] |
- --<<<
- -- Kaleida Labs, Inc.
- -- Field Guide to the ScriptX Language
- -- chapter 5, example 3
-
- function factorial n ->
- if n <= 0 then return 1
- else return (n * (factorial (n - 1)))
- -- now, try a few test values
- factorial 0
- factorial 4
-
- function sumAndPrint #rest args -> (
- local mysum:0
- for i in args do mysum := mysum + i
- format debug "The sum is: %*\n" mysum @normal
- return mysum
- )
-
- sumAndPrint 10 20 34 45
- -->>>